package numberOfMatches;

public class Solution {
    public int numberOfMatches(int n) {
        // 下一次比赛的队伍＝轮空的队伍 加 晋级的队伍
        int count=0;
        while(n>1){
            int l=n%2;
            count+=(n/=2);
            n+=l;
        }
        return count-1;
    }
}
